﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Boomerang.Management.UIForms
{
    public partial class FormLoading : Form
    {

        public BackgroundWorker Worker { get; set; }

        private RunWorkerCompletedEventArgs result;
        public RunWorkerCompletedEventArgs Result { get { return result; } }

        public FormLoading()
        {
            InitializeComponent();
            Worker = new BackgroundWorker();
            Worker.WorkerReportsProgress = true;
            Worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Worker_RunWorkerCompleted);
        }

        public FormLoading(string Message)
            : this()
        {
            this.labelTitle.Text = Message;
        }
        
        public string Message
        {
            get
            {
                return labelTitle.Text = Message;
            }
            set
            {
                labelTitle.Text = value;
            }
        }

        void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.result = e;
            this.Close();
        }
    }
}
